coos.table = function(){};

/**
 * 插入行tr的html形式
 * @param table tableId or obj
 * @param str line html
 * @param tbody customer tbody,default is table.tBodies[0]
 * @exsample 
<table id="lineTable" border="1" width="100"> 
    <tr><td>1</td><td>1</td></tr> 
</table> 
coos.table.insert(document.getElementById("lineTable"),"<tr><td>2</td><td>2</td></tr><tr><td>3</td><td>3</td></tr>");
 */
coos.table.insert = function(table,str,tbody)
{
	var table = coos.$obj(table);
	var tbody = tbody || table.tBodies[0];
	var div = document.createElement("div");
	div.innerHTML="<table>"+str+"</table>";
	var rows = div.childNodes[0].tBodies[0].rows;
	while(rows.length > 0)
	{
		tbody.appendChild(rows[0]);
	}
};

coos.table.deleteRow = function(table,tr,message)
{
	var table = coos.$obj(table);
	var tr = coos.$obj(tr);
	var message = message || "确定要删除该行吗?";
	if(confirm(message))
	{
		table.deleteRow(tr.rowIndex);
		return true;
	}
	return false;
};